package com.pig.serviceimpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.pig.entity.AccountLogEntity;
import com.pig.mapper.AccountInfoMapper;
import com.pig.mapper.AccountLogMapper;
import com.pig.pojo.AccounInfoPojo;
import com.pig.pojo.AccountLogPojo;
import com.pig.service.AccountInfoService;
import com.pig.service.AccountLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * 
 * @author 猪农
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class AccountLogImpl implements AccountLogService {

	@Autowired
	private AccountLogMapper accountLogMapper;

	/**
	 * 添加用户日志
	 * @param accountLogEntity
	 * @return
	 */
	@Override
	@Transactional(propagation = Propagation.REQUIRED)
	public Integer insertAccountLog(AccountLogEntity accountLogEntity) {
		return accountLogMapper.insertAccountLog(accountLogEntity);
	}

	/**
	 * 查询日志
	 * @return
	 */
	@Override
	public List<AccountLogPojo> queryAccountLog(Integer accountId) {
			List<AccountLogPojo> accountLogEntity = accountLogMapper.queryAccountLog(accountId);
			//包装结果 .....返回pageInfo
			return accountLogEntity;
	}

}
